<?php 	
	header('Access-Control-Allow-Origin: *');
	header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");
	header('Access-Control-Allow-Methods: GET, POST, PUT,DELETE');
	include('connect.php');

	// $name = 'guo';
	// $loginkey = '51d5329742d574a4cbfb120a115e4c4b';
	$name = $_POST['name'];
	$loginkey = $_POST['loginkey'];

	$rows = [];

	$sql = 'select user,permission,loginkey from admin where user="'.$name.'" and loginkey="'.$loginkey.'"';
	
	$result = $db->query($sql);

	if($result->num_rows== 0){
		$rows['code'] = '20001';
		$rows['msg'] = '请重新登录';
	}else{
		if($result->num_rows > 0){
			while($row = $result->fetch_array(MYSQLI_ASSOC)){
				$rows[] = $row;
			}
		}

		$rows['code'] = '20000';
		$rows['msg'] = '获取信息成功';
	}

	echo json_encode($rows);
	
	



